All Questions
Tagged with text-processingshell-script
1,125 questions
0votes
2answers
88views
List and count ciphers used by cryptsetup in /dev/mapper devices
In my Linux Computer there are many files called file1, file2, file3 ... in /dev/mapper/. Now I want to have an overview from the files what cipher is used how often. I tried this for i in /dev/...
4votes
3answers
220views
Add columns from variable number of files to base file
I'm dealing with a series of bed files, which look like this: chr1 100 110 0.5 chr1 150 175 0.2 chr1 200 300 1.5 With the columns being chromosome, start, end, score. I have multiple different files ...
1vote
3answers
84views
Loop ip list through geoiplookup and delete lines that do not match criteria
Thanks in advance for any ideas you present. My current project has me trying to loop a file containing a list of 1000's of IP addresses through geoiplookup and piping it to sed to delete all lines ...
-2votes
3answers
143views
Bash script to uncomment lines with leading spaces on a file with specific pattern
I try to uncomment specific lines from a file with patterns in oracle linux 8.6 using bash. There are leading white spaces on certain lines where the comments are not removed. I tried to uncomment the ...
0votes
1answer
115views
Find all files in directory and apply commands to each of them
I want to apply commands below to all files in a directory instead of one file. cat file.txt | sed -E "s/\@([0-9]+)\W+~(.*?)/\1 \2/g" | tr -d '~' cat file.txt | sed -E "s/\@([0-9]+).*\~...
2votes
3answers
86views
Printing a specific section everytime search results are matched
I have a pretty basic text file on a Linux machine that has stuff like Chapters, Dialogues and References. This is what it looks like Chapter: 1 One: Birds and Trees Birds are beautiful and trees ...
2votes
7answers
734views
Shell Script to Normalize the data
We have requirement to normalize the data ... Item field is comma delimited and irregular and it may have any items from 0 to max (lets say 100) Input: key1|desc field|item1,item2,item3,item4|extra ...
-3votes
2answers
100views
Using awk, append a value in last field in csv file based upon value in specific field
input.csv - "family_guy","Brian","b47f0a80-d848-4d81-a45b-7ba930e6048b","son" "family_guy","Brian","b47f0a80-d848-4d81-a45b-...
-2votes
1answer
362views
How to replace a parameter's value in json file with a value taken from a different text file
I have a a large number of JSON files on a Linux machine, where I need to change the value of a parameter with value taken from a different text file. E.g.: If the JSON file has values like: { "...
0votes
1answer
58views
Replacing variable correctly in alias function
I'm trying to create an alias function to remove inputted line from file: function remove_line(){ line_to_remove="'s/^"$1"$//g'" sed -i $(line_to_remove) my_file } ...
3votes
1answer
516views
How can I use $0 in Makefile?
I would like to include the following command (taken from here) in a Makefile. A simple version of my Makefile script containing the command is: copy_files: sed 's/^/\./' ./input_file | \ ...
7votes
5answers
1kviews
How to create grep output in the order of the input file?
I have a scrambledA.txt with data in a list like so: efrrsu aehmmr aeeglnr alnors acflno aaahmy aceimru 1469en aelprsy cehrry and a corresponding wordlistC.txt that contains many many key-value-pairs:...
0votes
0answers
69views
I want to print the actual gio launch command (e.g.)$ echo " gio launch /usr/share/applications/abiword.desktop" would print: $ Exec=abiword
I am aware that I could just use something like : grep Exec= /usr/share/applications/abiword.desktop I could also do something like: abiword=$(grep Exec= /usr/share/applications /abiword.desktop) ...
2votes
4answers
192views
Need help in removing ellipes (...) from a file using shell script
Need help in removing ellipes (…) from a file using shell script. I used sed command in various forms, but it doesn't help when running in a Unix box. Following commands were used but didn't help when ...
-1votes
1answer
135views
I need help making this bash script run faster [closed]
I have a script that takes a local log file, reads each line, ID's the card and the IO type, extracts the relevant data string, compares that string to definition files and assigns a T or F value to ...